package com.ruoyi.weiriya.domain;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseIdEntity;
import com.ruoyi.common.utils.StringUtils;
import lombok.Data;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;

/**
 * 插座信息对象 w_socket_two
 * 
 * @author ruoyi
 * @date 2023-08-16
 */
@Data
@ApiModel(value = "WSocketTwo", description = "插座信息对象")
public class WSocketTwo extends BaseIdEntity
{
    private static final long serialVersionUID = 1L;

    /** id */
    @ApiModelProperty("id")
    private String id;

    /** 数据原始ID */
    @ApiModelProperty("数据原始ID")
    private String originalId;

    /** 插座ID（设备ID） */
    @Excel(name = "插座ID", readConverterExp = "设=备ID")
    @ApiModelProperty("插座ID（设备ID）")
    private String plugId;

    /** 厂商ID */
    @Excel(name = "厂商ID")
    @ApiModelProperty("厂商ID")
    private String firmId;

    /** 网关ID */
    @Excel(name = "网关ID")
    @ApiModelProperty("网关ID")
    private String gatewayId;

    /** 插座号 */
    @Excel(name = "插座号")
    @ApiModelProperty("插座号")
    private Integer nodeIndex;

    /** 区域id */
    @Excel(name = "区域id")
    @ApiModelProperty("区域id")
    private String stationId;

    public <T> QueryWrapper<T> queryWrapper(){
        QueryWrapper<T> wrapper=new QueryWrapper<>();

        wrapper.like(StringUtils.isNotEmpty(id),"id" , id);
        wrapper.like(StringUtils.isNotEmpty(plugId),"plug_id" , plugId);
        wrapper.like(StringUtils.isNotEmpty(firmId),"firm_id" , firmId);
        wrapper.like(StringUtils.isNotEmpty(gatewayId),"gateway_id" , gatewayId);
        wrapper.eq(nodeIndex != null,"node_index" , nodeIndex);
        wrapper.like(StringUtils.isNotEmpty(stationId),"station_id" , stationId);
        wrapper.orderByDesc("create_time");
        return wrapper;
    }

}
